<template>
  <div class="container">
    <div class="subtitle">
      <p>
        <span class="title-point"></span>
        人车流量
      </p>
    </div>
    <div class="content">
      <div class="flux-box">
        <p>{{peopleCount}}</p>
        <span>
          人总
          <br />流数
        </span>
      </div>
      <div class="flux-box">
        <p>{{carCount}}</p>
        <span>
          车总
          <br />流数
        </span>
      </div>
    </div>
  </div>
</template>

<script>
  import https from '@/assets/js/https.js'
export default {
  name: "flux",
  data() {
    return {
      peopleCount: 0,
      carCount: 0,
      items: [],
    };
  },
  mounted() {
    this.getFlux();
    var that=this;
    this.$mytimer.addCallBack(this,function (host) {
      if (that==host){
        that.getFlux();
      }
    })
  },
  props: ["userId"],
  methods:{
        getFlux(){
        let params ={"userId":this.userId}
        let self = this;
        https.fetchGet('/web/VVID/flow',params ).then((data) => {
          self.carCount = data.data.motorVehicleCount
          self.peopleCount = data.data.faceCount
        }).catch(err=>{
                  console.log(err)
        }
        );
      }
  }
};
</script>

<style scoped lang="scss">
.container {
  width: 209px;
  height: 208px;
  background: url("../assets/image/bottom2.png");
  background-repeat: no-repeat;
  background-size: cover;
  padding: 10px;
}
.flux-box {
  width: 170px;
  height: 80px;
  background: url("../assets/image/circle1.png");
  background-repeat: no-repeat;
  background-size: cover;
  position: relative;
  top: -4px;
  display: flex;

  p {
    margin: 0;
    font-size: 22px;
    color: rgba(0, 250, 255, 1);
    width: 110px;
    text-align: center;
    padding-top: 28px;
  }
  span {
    font-size: 12px;
    text-align: center;
    padding: 20px 0 0 8px;
  }
}
</style>
